package com.clps.designPatterns.chapter02.线程安全问题;

import org.junit.Test;


public class C06_Singleton {


    @Test
    public  void test01(){
        SingletonDemo instance1 = SingletonDemo.INSTANCE;
        SingletonDemo instance2 = SingletonDemo.INSTANCE;
        System.out.println( instance2==instance1);
        instance1.info();
        instance2.info();

    }
}

enum  SingletonDemo{
    INSTANCE;
    public  void  info(){
        System.out.println("枚举方式实现单例");
    }
}
